package chen.huai.jie.spring.xmlconfig.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * 项目启动完毕之前会调用这个方法
 */
@Component
public class StartupListener implements ApplicationListener<ContextRefreshedEvent> {
    private Logger logger = LoggerFactory.getLogger(StartupListener.class);

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        handleAfterAppApplicationContext();
    }

    private void handleAfterAppApplicationContext() {
        logger.info("Init some task.");
    }

}
